// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

using System;

namespace FreshMeat.ErrorHandlingBlock
{
   /// <summary>
   /// Describes the plan for retrying an action when an error occurs.
   /// </summary>
   public interface IRetryPlan
   {
      /// <summary>
      /// Determine whether to retry based on the number of attempts.
      /// </summary>
      /// <param name="attempts">The number of attempts so far, including the initial attempt.</param>
      /// <returns>True to retry, false to fail.</returns>
      bool ShouldRetry(int attempts);

      /// <summary>
      /// Gets the time until the next attempt should be made.
      /// </summary>
      /// <param name="attempts">The number of attempts so far, including the initial attempt.</param>
      /// <returns>Time until the next attempt should be made.</returns>
      TimeSpan GetTimeUntilNextAttempt(int attempts);
   }
}